﻿import QtQuick 2.15
import QtQml 2.0
import QtQuick.Controls 2.15

Item {
    id: redSquare
    anchors.fill: parent
    Rectangle {
        anchors.fill: parent
        color: "#404142"
        Text {
            color: "#ffffff"
            text: qsTr("删除")
            anchors.verticalCenter: parent.verticalCenter
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.horizontalCenter: parent.horizontalCenter
        }
        MouseArea{
           anchors.fill: parent
           hoverEnabled: true
           propagateComposedEvents: false
           onClicked: {
               console.log("redSquare is clicked...")
               dbManager.delPerson(curruntIP, curruntPort)
               //刷新页面
               pageStackView.clear(StackView.Immediate)
               pageStackView.push("FirstPage.qml", StackView.Immediate)
           }
           onEntered:
           {
               cursorShape = Qt.ArrowCursor
           }
           onExited: {
               delLoader.source = ""
           }
        }
    }

}
